from PyQt6 import uic
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QMainWindow

from utils.index import resource_path
from front.jointWell import JointWellWindow

class JointWellNumWindow(QMainWindow):
    def __init__(self):
        super().__init__()
        self.module_name = "联井标定"
        self.ui = uic.loadUi(resource_path("static/ui/jointWellNum.ui"), self)  # 加载主窗口的 UI 文件
        self.init_style()
        self.init_event()

    # ========================================================
    # 初始化
    # ========================================================

    # 设置窗口图标和标题
    def init_style(self):
        self.ui.setWindowTitle(f"SeismicPlot-{self.module_name}")
        self.ui.setWindowIcon(QIcon(resource_path('static/image/favicon.ico')))
        self.ui.setStyleSheet("background-color: white;")
        self.ui.lineEdit.setStyleSheet("border: none; background-color: transparent;")

    # 初始化事件
    def init_event(self):
        self.ui.toolButton.clicked.connect(self.open_joint_well_window)

    # 打开联井标定窗口
    def open_joint_well_window(self):
        print(f"联井数为：{self.ui.spinBox.text()}")
        self.joint_well_window = JointWellWindow(self.ui.spinBox.text())
        self.joint_well_window.show()
        self.ui.close()